home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: dmocc2.on.bell.ca!bc2cep!news
- From: Eric Marc Loebenberg <loebenbe@qc.bell.ca>
- Subject: Re: readfile question
- X-Nntp-Posting-Host: cmocft.qc.bell.ca
- Content-Type: text/plain; charset=iso-8859-1
- Message-ID: <3173A76B.A1A@qc.bell.ca>
- Sender: news@on.bell.ca (news admin)
- Content-Transfer-Encoding: 8bit
- Cc: cs805-06@mcs.csuhayward.edu
- Organization: Bell Sygma
- References: <cs805-06-1404962104230001@10.0.2.15>
- Mime-Version: 1.0
- Date: Tue, 16 Apr 1996 13:58:03 GMT
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- Steve wrote:
- >
- > Hi, I would like to know if there is a c++ function that will read
- > characters from a string untill it reaches a space. I saw that there is a
- > function that reads until it gets to a newline, but cant find anything
- > that reads until it gets to a spaceSteve,
-
- Normally you would read either a fixed chunk of data or a line (i.e.
- up to first \n) into a buffer and then use buffer manipulation (string)
- manipulation routines to either tokenize or manipulate your data. For
- example, you could use CString::Find tolocate your space.
-
- You can also use the standard C library to achieve what you want:
-
- #include <stdio.h>
- int fscanf( FILE *stream, const char *format [, argument ]... );
-
- allows you to read from the file up to a blank.
-
- You probably would prefer to use a C++ technique...
-
- I hope that helps.
-
- ***************************************************************
- Eric Marc Loebenberg loebenbe@qc.bell.ca
- Bell Sygma Inc. or: loebenbe@post.sygma.net
- 700 de la GauchetiΦre West Tel: 514-870-0465
- Room 14W1 Fax: 514-870-7583
- Montreal, Quebec, Canada
- H3B 4L1
-